(function(){if(window.jsDD)return;jsDD={arObjects:[],arDestinations:[],arDestinationsPriority:[],arContainers:[],arContainersPos:[],current_dest_index:false,current_node:null,wndSize:null,bStarted:false,bDisable:false,bDisableDestRefresh:false,bEscPressed:false,bScrollWindow:false,scrollViewTimer:null,scrollViewConfig:{checkerTimeout:30,scrollZone:25,scrollBy:25,scrollContainer:null,bScrollH:true,bScrollV:true,pos:null},setScrollWindow:function(s){jsDD.bScrollWindow=!!s;if(BX.type.isDomNode(s)){jsDD.scrollViewConfig.scrollContainer=s;jsDD.scrollViewConfig.pos=BX.pos(s);var e=BX.style(s,"overflow")||"visible",D=BX.style(s,"overflow-x")||"visible",r=BX.style(s,"overflow-y")||"visible";jsDD.scrollViewConfig.bScrollH=e!="visible"||D!="visible";jsDD.scrollViewConfig.bScrollV=e!="visible"||r!="visible"}},Reset:function(){jsDD.arObjects=[];jsDD.arDestinations=[];jsDD.arDestinationsPriority=[];jsDD.bStarted=false;jsDD.current_node=null;jsDD.current_dest_index=false;jsDD.bDisableDestRefresh=false;jsDD.bDisable=false;jsDD.x=null;jsDD.y=null;jsDD.start_x=null;jsDD.start_y=null;jsDD.wndSize=null;jsDD.bEscPressed=false;clearInterval(jsDD.scrollViewTimer);jsDD.bScrollWindow=false;jsDD.scrollViewTimer=null;jsDD.scrollViewConfig.scrollContainer=null},registerObject:function(s){BX.bind(s,"mousedown",jsDD.startDrag);BX.Event.bind(s,"touchstart",jsDD.startDrag,{passive:true});s.__bxddid=jsDD.arObjects.length;jsDD.arObjects[s.__bxddid]=s},unregisterObject:function(s){if(typeof s["__bxddid"]==="undefined"){return}delete jsDD.arObjects[s.__bxddid];delete s.__bxddid;BX.unbind(s,"mousedown",jsDD.startDrag);BX.unbind(s,"touchstart",jsDD.startDrag)},registerDest:function(s,e){if(!e)e=100;s.__bxddeid=jsDD.arDestinations.length;s.__bxddpriority=e;jsDD.arDestinations[s.__bxddeid]=s;if(!jsDD.arDestinationsPriority[e])jsDD.arDestinationsPriority[e]=[s.__bxddeid];else jsDD.arDestinationsPriority[e].push(s.__bxddeid);jsDD.refreshDestArea(s.__bxddeid)},unregisterDest:function(s){if(typeof s["__bxddeid"]==="undefined"){return}delete jsDD.arDestinations[s.__bxddeid];delete s.__bxddeid;delete s.__bxddpriority;jsDD.refreshDestArea()},disableDest:function(s){if(typeof s.__bxddeid!=="undefined"){s.__bxdddisabled=true}},enableDest:function(s){if(typeof s.__bxddeid!=="undefined"){s.__bxdddisabled=false}},registerContainer:function(s){jsDD.arContainers[jsDD.arContainers.length]=s},getContainersScrollPos:function(s,e){var D={left:0,top:0};for(var r=0,n=jsDD.arContainers.length;r<n;r++){if(jsDD.arContainers[r]&&s>=jsDD.arContainersPos[r]["left"]&&s<=jsDD.arContainersPos[r]["right"]&&e>=jsDD.arContainersPos[r]["top"]&&e<=jsDD.arContainersPos[r]["bottom"]){D.left=jsDD.arContainers[r].scrollLeft;D.top=jsDD.arContainers[r].scrollTop}}return D},setContainersPos:function(){for(var s=0,e=jsDD.arContainers.length;s<e;s++){if(jsDD.arContainers[s])jsDD.arContainersPos[s]=BX.pos(jsDD.arContainers[s])}},refreshDestArea:function(s){if(s&&typeof s=="object"&&typeof s.__bxddeid!="undefined"){s=s.__bxddeid}if(typeof s=="undefined"){for(var e=0,D=jsDD.arDestinations.length;e<D;e++){jsDD.refreshDestArea(e)}}else{if(null==jsDD.arDestinations[s])return;var r=BX.pos(jsDD.arDestinations[s]);jsDD.arDestinations[s].__bxpos=[r.left,r.top,r.right,r.bottom]}},_checkEsc:function(s){s=s||window.event;if(jsDD.bStarted&&s.keyCode==27){jsDD.stopCurrentDrag()}},stopCurrentDrag:function(){if(jsDD.bStarted){jsDD.bEscPressed=true;jsDD.stopDrag()}},_onscroll:function(){jsDD.wndSize=BX.GetWindowSize()},_checkScroll:function(){if(jsDD.bScrollWindow){var s={clientX:jsDD.x-jsDD.wndSize.scrollLeft,clientY:jsDD.y-jsDD.wndSize.scrollTop},e=false,D=jsDD.scrollViewConfig.scrollZone;if(s.clientY<D&&jsDD.wndSize.scrollTop>0){window.scrollBy(0,-jsDD.scrollViewConfig.scrollBy);e=true}if(s.clientY>jsDD.wndSize.innerHeight-D&&jsDD.wndSize.scrollTop<jsDD.wndSize.scrollHeight-jsDD.wndSize.innerHeight){window.scrollBy(0,jsDD.scrollViewConfig.scrollBy);e=true}if(s.clientX<D&&jsDD.wndSize.scrollLeft>0){window.scrollBy(-jsDD.scrollViewConfig.scrollBy,0);e=true}if(s.clientX>jsDD.wndSize.innerWidth-D&&jsDD.wndSize.scrollLeft<jsDD.wndSize.scrollWidth-jsDD.wndSize.innerWidth){window.scrollBy(jsDD.scrollViewConfig.scrollBy,0);e=true}if(jsDD.scrollViewConfig.scrollContainer){var r=jsDD.scrollViewConfig.scrollContainer;if(jsDD.scrollViewConfig.bScrollH){if(s.clientX+jsDD.wndSize.scrollLeft<jsDD.scrollViewConfig.pos.left+D&&r.scrollLeft>0){r.scrollLeft-=jsDD.scrollViewConfig.scrollBy;e=true}if(s.clientX+jsDD.wndSize.scrollLeft>jsDD.scrollViewConfig.pos.right-D&&r.scrollLeft<r.scrollWidth-r.offsetWidth){r.scrollLeft+=jsDD.scrollViewConfig.scrollBy;e=true}}if(jsDD.scrollViewConfig.bScrollV){if(s.clientY+jsDD.wndSize.scrollTop<jsDD.scrollViewConfig.pos.top+D&&r.scrollTop>0){r.scrollTop-=jsDD.scrollViewConfig.scrollBy;e=true}if(s.clientY+jsDD.wndSize.scrollTop>jsDD.scrollViewConfig.pos.bottom-D&&r.scrollTop<r.scrollHeight-r.offsetHeight){r.scrollTop+=jsDD.scrollViewConfig.scrollBy;e=true}}}if(e){jsDD._onscroll();jsDD.drag(s)}}},startDrag:function(s){if(jsDD.bDisable)return true;s=s||window.event;if(!(BX.getEventButton(s)&BX.MSLEFT))return true;jsDD.current_node=null;if(s.currentTarget){jsDD.current_node=s.currentTarget;if(null==jsDD.current_node||null==jsDD.current_node.__bxddid){jsDD.current_node=null;return}}else{jsDD.current_node=s.srcElement;if(null==jsDD.current_node)return;while(null==jsDD.current_node.__bxddid){jsDD.current_node=jsDD.current_node.parentNode;if(jsDD.current_node.tagName=="BODY")return}}jsDD.bStarted=false;jsDD.bPreStarted=true;jsDD.wndSize=BX.GetWindowSize();jsDD.start_x=s.clientX+jsDD.wndSize.scrollLeft;jsDD.start_y=s.clientY+jsDD.wndSize.scrollTop;BX.bind(document,"mouseup",jsDD.stopDrag);BX.bind(document,"touchend",jsDD.stopDrag);BX.bind(document,"mousemove",jsDD.drag);BX.bind(document,"touchmove",jsDD.drag);BX.bind(window,"scroll",jsDD._onscroll);if(document.body.setCapture)document.body.setCapture();if(!jsDD.bDisableDestRefresh)jsDD.refreshDestArea();jsDD.setContainersPos();if(s.type!=="touchstart"){jsDD.denySelection();return BX.PreventDefault(s)}else{return true}},start:function(){if(jsDD.bDisable)return true;document.body.style.cursor="move";if(jsDD.current_node.onbxdragstart)jsDD.current_node.onbxdragstart();for(var s=0,e=jsDD.arDestinations.length;s<e;s++){if(jsDD.arDestinations[s]&&jsDD.arDestinations[s].onbxdestdragstart)jsDD.arDestinations[s].onbxdestdragstart(jsDD.current_node)}jsDD.bStarted=true;jsDD.bPreStarted=false;if(jsDD.bScrollWindow){if(jsDD.scrollViewTimer)clearInterval(jsDD.scrollViewTimer);jsDD.scrollViewTimer=setInterval(jsDD._checkScroll,jsDD.scrollViewConfig.checkerTimeout)}BX.bind(document,"keypress",this._checkEsc)},drag:function(s){if(jsDD.bDisable)return true;s=s||window.event;jsDD.x=s.clientX+jsDD.wndSize.scrollLeft;jsDD.y=s.clientY+jsDD.wndSize.scrollTop;if(!jsDD.bStarted){var e=5;if(jsDD.x>=jsDD.start_x-e&&jsDD.x<=jsDD.start_x+e&&jsDD.y>=jsDD.start_y-e&&jsDD.y<=jsDD.start_y+e)return true;jsDD.start()}if(jsDD.current_node.onbxdrag){jsDD.current_node.onbxdrag(jsDD.x,jsDD.y,s)}var D=jsDD.getContainersScrollPos(jsDD.x,jsDD.y);var r=jsDD.searchDest(jsDD.x+D.left,jsDD.y+D.top);if(r!==jsDD.current_dest_index){if(jsDD.current_dest_index!==false){if(jsDD.current_node.onbxdraghout)jsDD.current_node.onbxdraghout(jsDD.arDestinations[jsDD.current_dest_index],jsDD.x,jsDD.y);if(jsDD.arDestinations[jsDD.current_dest_index].onbxdestdraghout)jsDD.arDestinations[jsDD.current_dest_index].onbxdestdraghout(jsDD.current_node,jsDD.x,jsDD.y)}if(r!==false){if(jsDD.current_node.onbxdraghover)jsDD.current_node.onbxdraghover(jsDD.arDestinations[r],jsDD.x,jsDD.y);if(jsDD.arDestinations[r].onbxdestdraghover)jsDD.arDestinations[r].onbxdestdraghover(jsDD.current_node,jsDD.x,jsDD.y)}}jsDD.current_dest_index=r},stopDrag:function(s){BX.unbind(document,"keypress",jsDD._checkEsc);s=s||window.event;jsDD.bPreStarted=false;if(jsDD.bStarted){if(!jsDD.bEscPressed){jsDD.x=s.clientX+jsDD.wndSize.scrollLeft;jsDD.y=s.clientY+jsDD.wndSize.scrollTop}if(null!=jsDD.current_node.onbxdragstop)jsDD.current_node.onbxdragstop(jsDD.x,jsDD.y,s);var e=jsDD.getContainersScrollPos(jsDD.x,jsDD.y);var D=jsDD.searchDest(jsDD.x+e.left,jsDD.y+e.top);if(false!==D){if(jsDD.bEscPressed){if(null!=jsDD.arDestinations[D].onbxdestdraghout){if(!jsDD.arDestinations[D].onbxdestdraghout(jsDD.current_node,jsDD.x,jsDD.y))D=false;else{if(null!=jsDD.current_node.onbxdragfinish)jsDD.current_node.onbxdragfinish(jsDD.arDestinations[D],jsDD.x,jsDD.y)}}}else{if(null!=jsDD.arDestinations[D].onbxdestdragfinish){if(!jsDD.arDestinations[D].onbxdestdragfinish(jsDD.current_node,jsDD.x,jsDD.y,s))D=false;else{if(null!=jsDD.current_node.onbxdragfinish)jsDD.current_node.onbxdragfinish(jsDD.arDestinations[D],jsDD.x,jsDD.y)}}}}if(false===D){if(null!=jsDD.current_node.onbxdragrelease)jsDD.current_node.onbxdragrelease(jsDD.x,jsDD.y)}else{for(var r=0,n=jsDD.arDestinations.length;r<n;r++){if(r!=D&&jsDD.arDestinations[r]&&null!=jsDD.arDestinations[r].onbxdestdragrelease)jsDD.arDestinations[r].onbxdestdragrelease(jsDD.current_node,jsDD.x,jsDD.y)}}for(var r=0,n=jsDD.arDestinations.length;r<n;r++){if(jsDD.arDestinations[r]&&null!=jsDD.arDestinations[r].onbxdestdragstop)jsDD.arDestinations[r].onbxdestdragstop(jsDD.current_node,jsDD.x,jsDD.y)}}if(document.body.releaseCapture)document.body.releaseCapture();BX.unbind(window,"scroll",jsDD._onscroll);BX.unbind(document,"mousemove",jsDD.drag);BX.unbind(document,"touchmove",jsDD.drag);BX.unbind(document,"keypress",jsDD._checkEsc);BX.unbind(document,"mouseup",jsDD.stopDrag);BX.unbind(document,"touchend",jsDD.stopDrag);jsDD.allowSelection();document.body.style.cursor="";jsDD.current_node=null;jsDD.current_dest_index=false;if(jsDD.bScrollWindow){if(jsDD.scrollViewTimer)clearInterval(jsDD.scrollViewTimer)}if(jsDD.bStarted&&!jsDD.bDisableDestRefresh)jsDD.refreshDestArea();jsDD.bStarted=false;jsDD.bEscPressed=false},searchDest:function(s,e){var D,r,n,t,o;for(D=0,r=jsDD.arDestinationsPriority.length;D<r;D++){if(jsDD.arDestinationsPriority[D]&&BX.type.isArray(jsDD.arDestinationsPriority[D])){for(n=0,t=jsDD.arDestinationsPriority[D].length;n<t;n++){o=jsDD.arDestinationsPriority[D][n];if(jsDD.arDestinations[o]&&!jsDD.arDestinations[o].__bxdddisabled){if(jsDD.arDestinations[o].__bxpos[0]<=s&&jsDD.arDestinations[o].__bxpos[2]>=s&&jsDD.arDestinations[o].__bxpos[1]<=e&&jsDD.arDestinations[o].__bxpos[3]>=e){return o}}}}}return false},allowSelection:function(){document.onmousedown=document.ontouchstart=null;var s=document.body;s.ondrag=null;s.onselectstart=null;s.style.MozUserSelect="";if(jsDD.current_node){jsDD.current_node.ondrag=null;jsDD.current_node.onselectstart=null;jsDD.current_node.style.MozUserSelect=""}},denySelection:function(){document.onmousedown=document.ontouchstart=BX.False;var s=document.body;s.ondrag=BX.False;s.onselectstart=BX.False;s.style.MozUserSelect="none";if(jsDD.current_node){jsDD.current_node.ondrag=BX.False;jsDD.current_node.onselectstart=BX.False;jsDD.current_node.style.MozUserSelect="none"}},Disable:function(){jsDD.bDisable=true},Enable:function(){jsDD.bDisable=false}}})();
//# sourceMappingURL=dd.map.js